package com.threegroup.android3grouppersonality.ui.fragment;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.threegroup.android3grouppersonality.R;
import com.threegroup.android3grouppersonality.ui.activity.InstallActivity;
import com.threegroup.android3grouppersonality.ui.activity.ModifyInformationActivity;
import com.threegroup.android3grouppersonality.ui.activity.PersoninfoActivity;
import com.threegroup.android3grouppersonality.ui.activity.StartActivity;
import com.threegroup.android3grouppersonality.utils.HttpCircleImageView;
import com.threegroup.android3grouppersonality.utils.Tool;


public class MeFragment extends Fragment implements View.OnClickListener {

    private SharedPreferences sp;
    //用户名，简介，博客数，关注数，粉丝数，步数
    private TextView tv_meUserName, tv_meUserIntroduction, tv_meBlogNum, tv_meFollowNum, tv_meFansNum, tv_meSteps;
    //我的发布，我的收藏，修改信息，我的钱包，设置，草稿，客服，历史记录
    private ImageView iv_mePublished, iv_meCollection, iv_meUpInfo, iv_meMyWallet, iv_meInstall, iv_meDraft, tv_meService, iv_meHistory;
    //头像
    private HttpCircleImageView iv_mePhoto;
    private LinearLayout li_Userdatil;
    private ImageLoader imageLoader = ImageLoader.getInstance();

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_me, container, false);

        tv_meUserName = view.findViewById(R.id.tv_meUserName);
        tv_meUserIntroduction = view.findViewById(R.id.tv_meUserIntroduction);
        tv_meBlogNum = view.findViewById(R.id.tv_meBlogNum);
        tv_meFollowNum = view.findViewById(R.id.tv_meFollowNum);
        tv_meFansNum = view.findViewById(R.id.tv_meFansNum);
        tv_meSteps = view.findViewById(R.id.tv_meSteps);
        iv_mePublished = view.findViewById(R.id.iv_mePublished);
        iv_meCollection = view.findViewById(R.id.iv_meCollection);
        iv_meUpInfo = view.findViewById(R.id.iv_meUpInfo);
        iv_meMyWallet = view.findViewById(R.id.iv_meMyWallet);
        iv_meInstall = view.findViewById(R.id.iv_meInstall);
        iv_meDraft = view.findViewById(R.id.iv_meDraft);
        tv_meService = view.findViewById(R.id.tv_meService);
        iv_meHistory = view.findViewById(R.id.iv_meHistory);
        iv_mePhoto = view.findViewById(R.id.iv_mePhoto);
        li_Userdatil=view.findViewById(R.id.li_userdatil);
        iv_mePublished.setOnClickListener(this);
        iv_meCollection.setOnClickListener(this);
        iv_meUpInfo.setOnClickListener(this);
        iv_meMyWallet.setOnClickListener(this);
        iv_meInstall.setOnClickListener(this);
        iv_meDraft.setOnClickListener(this);
        tv_meService.setOnClickListener(this);
        iv_meHistory.setOnClickListener(this);
        li_Userdatil.setOnClickListener(this);
        sp = getContext().getSharedPreferences("share", 0);
        return view;
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_meUpInfo:
                Intent intent = new Intent(getContext(), ModifyInformationActivity.class);
                startActivityForResult(intent, Tool.To_ModifyINfomationActivity);
                break;
            case R.id.iv_meInstall:
                Intent intent1 = new Intent(getContext(), InstallActivity.class);
                startActivityForResult(intent1, Tool.To_InstallActivity);
                break;
            case R.id.li_userdatil:
                Intent intent2 = new Intent(getContext(), PersoninfoActivity.class);
                startActivityForResult(intent2, Tool.To_PersoninfoActivity);
                break;
        }
    }
}
